package ${controllerPackage}.${prefix}.response;

import ${modelPackage}.${prefix}.${modelName};
import cn.udesk.cem.model.sys.Organization;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.github.fanfever.fever.bean.Converter;
import lombok.Data;
import org.springframework.beans.BeanUtils;

<#list importList as import>
import ${import};
</#list>

/**
* Created by ${author} on ${date}.
*/
@Data
@ApiModel
public class ${modelName}FoundResponse implements Converter<${modelName}, ${modelName}FoundResponse> {
<#assign sysFields=["createTime","updateTime","createUserId","updateUserId","companyId","languageCode","deleteFlag","level"]>
<#list columnInfoList as col>
	<#if col.modelColumnName=="organizationId">

   /**
    *  组织机构
    */
    @ApiModelProperty(value="组织机构")
    private OrganizationResponse organization;
    <#elseif !sysFields?seq_contains(col.modelColumnName) >
    
	<#if col.javaType=="LocalDateTime">
    /**
     * ${col.comment}
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value="${col.comment}")
    private ${col.javaType} ${col.modelColumnName};
    <#else>
    /**
     * ${col.comment}
     */
    @ApiModelProperty(value="${col.comment}")
    private ${col.javaType} ${col.modelColumnName};
    </#if>
    </#if>
</#list>

	@Data
	@ApiModel
	public static class OrganizationResponse implements Converter<Organization, OrganizationResponse> {

		// 组织机构id
		@ApiModelProperty(value="组织机构id")
		private Integer id;

		@Override
		public OrganizationResponse convert(Organization s) {
			OrganizationResponse t = new OrganizationResponse();
			if(null!=s) {
				t.setId(s.getId());
			}
			return t;
		}

	}

    @Override
    public ${modelName}FoundResponse convert(${modelName} s) {
        ${modelName}FoundResponse t = new ${modelName}FoundResponse();
        BeanUtils.copyProperties(s, t);
        t.setOrganization(new OrganizationResponse().convert(s.getOrganization()));
        return t;
    }
}